package me.arithmetic_practice.pra2;

public class Test2 {
    public static void main(String[] args) {
        //不死神兔问题
        //方法一
        /*int[] arr = new int[12];
        //手动给前两个月赋值
        arr[0] = 1;
        arr[1] = 1;
        for (int i = 2; i < arr.length; i++) {
            arr[i] = arr[i - 1] + arr[i - 2];
        }*/
        //System.out.println(arr[11]);


        //方法二
        //递归的方式
        System.out.println(getSum(12));
    }

    public static int getSum(int month) {
        if (month == 1 || month == 2) {
            return 1;
        } else {
            return getSum(month - 1) + getSum(month - 2);
        }
    }
}
